package com.ateam.biz.impl;

import com.ateam.biz.ActivitiesBiz;
import com.ateam.dao.ActivitiesDao;
import com.ateam.pojo.Activities;

/** 
* @author WuYuan
* 
*/
public class ActivitiesBizImpl implements ActivitiesBiz {
	private ActivitiesDao activitiesDao;
	
	
	public ActivitiesDao getActivitiesDao() {
		return activitiesDao;
	}


	public void setActivitiesDao(ActivitiesDao activitiesDao) {
		this.activitiesDao = activitiesDao;
	}


	@Override
	public int addActivity(Activities activity, int[] memberids, int groupid, int projectid) {
		activity.setIscompleted("0");
		activity.setGroupid(groupid);
		activity.setProjectid(projectid);
		try {
			if(0!=activitiesDao.addActivity(activity)){
				for(int i=0;i<=memberids.length-1;i++){
					activitiesDao.addActivitymember(memberids[i], activity.getActivityid());
				}
			return 1;
			}else
			return 0;
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return 0;
	}

}
